/**
 * Selling Partner API for Orders
 * Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop fast, flexible, and custom applications to manage order synchronization, perform order research, and create demand-based decision support tools.   _Note:_ For the JP, AU, and SG marketplaces, the Orders API supports orders from 2016 onward. For all other marketplaces, the Orders API supports orders for the last two years (orders older than this don't show up in the response).
 *
 * The version of the OpenAPI document: v0
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */

import { ApiClient } from '../ApiClient.js'

/**
 * The PrescriptionDetail model module.
 * @module orders_v0/model/PrescriptionDetail
 * @version v0
 */
export class PrescriptionDetail {
  /**
   * Constructs a new <code>PrescriptionDetail</code>.
   * Information about the prescription that is used to verify a regulated product. This must be provided once per order and reflect the seller’s own records. Only approved orders can have prescriptions.
   * @alias module:orders_v0/model/PrescriptionDetail
   * @class
   * @param prescriptionId {String} The identifier for the prescription used to verify the regulated product.
   * @param expirationDate {Date} The expiration date of the prescription used to verify the regulated product, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format.
   * @param writtenQuantity {Number} The number of units in each fill as provided in the prescription.
   * @param totalRefillsAuthorized {Number} The total number of refills written in the original prescription used to verify the regulated product. If a prescription originally had no refills, this value must be 0.
   * @param refillsRemaining {Number} The number of refills remaining for the prescription used to verify the regulated product. If a prescription originally had 10 total refills, this value must be `10` for the first order, `9` for the second order, and `0` for the eleventh order. If a prescription originally had no refills, this value must be 0.
   * @param clinicId {String} The identifier for the clinic which provided the prescription used to verify the regulated product.
   * @param usageInstructions {String} The instructions for the prescription as provided by the approver of the regulated product.
   */
  constructor (prescriptionId, expirationDate, writtenQuantity, totalRefillsAuthorized, refillsRemaining, clinicId, usageInstructions) {
    this.prescriptionId = prescriptionId
    this.expirationDate = expirationDate
    this.writtenQuantity = writtenQuantity
    this.totalRefillsAuthorized = totalRefillsAuthorized
    this.refillsRemaining = refillsRemaining
    this.clinicId = clinicId
    this.usageInstructions = usageInstructions
  }

  /**
   * Constructs a <code>PrescriptionDetail</code> from a plain JavaScript object, optionally creating a new instance.
   * Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
   * @param {Object} data The plain JavaScript object bearing properties of interest.
   * @param {PrescriptionDetail} obj Optional instance to populate.
   * @return {PrescriptionDetail} The populated <code>PrescriptionDetail</code> instance.
   */
  static constructFromObject (data, obj) {
    if (data) {
      switch (typeof data) {
        case 'string':
          obj = String(data)
          break
        case 'number':
          obj = Number(data)
          break
        case 'boolean':
          obj = Boolean(data)
          break
      }
      obj = obj || new PrescriptionDetail()
      if (data.hasOwnProperty('prescriptionId')) { obj.prescriptionId = ApiClient.convertToType(data.prescriptionId, 'String') }
      if (data.hasOwnProperty('expirationDate')) { obj.expirationDate = ApiClient.convertToType(data.expirationDate, 'Date') }
      if (data.hasOwnProperty('writtenQuantity')) { obj.writtenQuantity = ApiClient.convertToType(data.writtenQuantity, 'Number') }
      if (data.hasOwnProperty('totalRefillsAuthorized')) { obj.totalRefillsAuthorized = ApiClient.convertToType(data.totalRefillsAuthorized, 'Number') }
      if (data.hasOwnProperty('refillsRemaining')) { obj.refillsRemaining = ApiClient.convertToType(data.refillsRemaining, 'Number') }
      if (data.hasOwnProperty('clinicId')) { obj.clinicId = ApiClient.convertToType(data.clinicId, 'String') }
      if (data.hasOwnProperty('usageInstructions')) { obj.usageInstructions = ApiClient.convertToType(data.usageInstructions, 'String') }
    }
    return obj
  }
}

/**
 * The identifier for the prescription used to verify the regulated product.
 * @member {String} prescriptionId
 * @type {String}
 */
PrescriptionDetail.prototype.prescriptionId = undefined

/**
 * The expiration date of the prescription used to verify the regulated product, in [ISO 8601](https://developer-docs.amazon.com/sp-api/docs/iso-8601) date time format.
 * @member {Date} expirationDate
 * @type {Date}
 */
PrescriptionDetail.prototype.expirationDate = undefined

/**
 * The number of units in each fill as provided in the prescription.
 * @member {Number} writtenQuantity
 * @type {Number}
 */
PrescriptionDetail.prototype.writtenQuantity = undefined

/**
 * The total number of refills written in the original prescription used to verify the regulated product. If a prescription originally had no refills, this value must be 0.
 * @member {Number} totalRefillsAuthorized
 * @type {Number}
 */
PrescriptionDetail.prototype.totalRefillsAuthorized = undefined

/**
 * The number of refills remaining for the prescription used to verify the regulated product. If a prescription originally had 10 total refills, this value must be `10` for the first order, `9` for the second order, and `0` for the eleventh order. If a prescription originally had no refills, this value must be 0.
 * @member {Number} refillsRemaining
 * @type {Number}
 */
PrescriptionDetail.prototype.refillsRemaining = undefined

/**
 * The identifier for the clinic which provided the prescription used to verify the regulated product.
 * @member {String} clinicId
 * @type {String}
 */
PrescriptionDetail.prototype.clinicId = undefined

/**
 * The instructions for the prescription as provided by the approver of the regulated product.
 * @member {String} usageInstructions
 * @type {String}
 */
PrescriptionDetail.prototype.usageInstructions = undefined
